import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

void main() => runApp(MaterialApp(
      home: HomePage(),
    ));

class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("ink水波纹"),
      ),
      body: Center(
        child: new Material(
          //INK可以实现装饰容器
          child: new Ink(
            //用ink圆角矩形
            // color: Colors.red,
            decoration: new BoxDecoration(
              //不能同时”使用Ink的变量color属性以及decoration属性，两个只能存在一个
              color: Colors.purple,
              //设置圆角
              borderRadius: new BorderRadius.all(new Radius.circular(25.0)),
            ),
            child: new InkWell(
              //圆角设置,给水波纹也设置同样的圆角
              //如果这里不设置就会出现矩形的水波纹效果
              borderRadius: new BorderRadius.circular(25.0),
              //设置点击事件回调
              onTap: () {},
              child: new Container(
                width: 300.0,
                height: 50.0,
                //设置child 居中
                alignment: Alignment(0, 0),
                child: Text(
                  "登录",
                  style: TextStyle(color: Colors.white, fontSize: 16.0),
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }
}
